package edu.uis.csc478.spring09.threeoxen.persistence.user.impl;

import edu.uis.csc478.spring09.threeoxen.persistence.user.UserRepository;
import edu.uis.csc478.spring09.threeoxen.persistence.user.User;
import edu.uis.csc478.spring09.threeoxen.persistence.BaseRepository;

import java.util.HashMap;

public class UserRepositoryImpl extends BaseRepository implements UserRepository {

    private HashMap users = new HashMap();

    UserRepositoryImpl() {

    }

    @Override
    public User getUser(String userid) {
        return (User) this.users.get(userid);
    }

    @Override
    public void addUser(User user) {
        this.users.put(user.getUserName(), user);
    }

    @Override
    public void removeUser(String userid) {
        this.users.remove(userid);
    }

    @Override
    public boolean userExists(String userid) {
        return this.users.get(userid) != null;
    }
}
